package com.lanyeo.liver.ui

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.widget.SeekBar
import com.lanyeo.liver.databinding.TaskFishingBinding

class SettingFinishing(context: Context) : ISetting {
    private var _binding: TaskFishingBinding? = null
    private val binding get() = _binding!!
    private var pullPrecision = 20F
    private var gotPrecision = 20F
    init {
        _binding = TaskFishingBinding.inflate(LayoutInflater.from(context))
        binding.sbPullPrecision.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener{
            override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
                pullPrecision = progress.toFloat()
                binding.tvPullPrecision.text = progress.toString()
            }

            override fun onStartTrackingTouch(seekBar: SeekBar?) {
            }

            override fun onStopTrackingTouch(seekBar: SeekBar?) {
            }

        })
        binding.sbGotPrecision.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener{
            override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
                gotPrecision = progress.toFloat()
                binding.tvGotPrecision.text = progress.toString()
            }

            override fun onStartTrackingTouch(seekBar: SeekBar?) {
            }

            override fun onStopTrackingTouch(seekBar: SeekBar?) {
            }
        })
    }
    override fun view(): View {
        return binding.root
    }

    override fun params(): Any {
        return listOf(pullPrecision, gotPrecision)
    }
}